package logic

import (
	"context"
	"errors"
	"user_srv/internal/dao"

	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type LightAchievementLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewLightAchievementLogic(ctx context.Context, svcCtx *svc.ServiceContext) *LightAchievementLogic {
	return &LightAchievementLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 点亮成就
func (l *LightAchievementLogic) LightAchievement(in *user.LightAchievementRequest) (*user.LightAchievementResponse, error) {
	// todo: add your logic here and delete this line
	achievement, err := dao.LightAchievement(in)
	if err != nil {
		return nil, errors.New("点亮成就失败")
	}
	return &user.LightAchievementResponse{
		Id: int64(achievement.Id),
	}, nil
}
